<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>防雷检测管理系统</title>
    <link rel="shortcut icon" type="image/x-icon" href="${ctxPath}/images/title_icon.ico" />
    <link rel="stylesheet" href="${ctxPath}/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="${ctxPath}/plugins/layui/css/login.css"></link>
    <script type="text/javascript" src="${ctxPath}/plugins/layui/layui.js"></script>
    <script type="text/javascript" src="${ctxPath}/js/jquery-3.2.0.min.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        body {
            text-align: center
        }
    </style>
</head>
<body class="loginbody">
<div id="container">
    <div id="bd">
        <div id="top">
            <h1 style="margin-top:25px;color:#FFFFFF">防雷检测管理系统</h1>
        </div>
        <div id="loginbg" class="loginbg" style="margin:0 auto; width:500px; height:500px;">
            <div id="login_form" class="login_form">
                <p class="form_name">登录管理系统</p>
                <div id="table_login">
                        <input type="text" placeholder="请输入用户名" name="code" id="Login_operCd" class="name"/>
                        <input type="password" placeholder="请输入密码" class="password" name="password" id="Login_operPwd"/>
                        <!--<div style="width: 115px;height: 43px;display: flex;background-color: #fff;padding: 35px;">-->
                    <!--<input type="text" style="    padding-left: 28px;width: 150px;height: 43px;border: #bbb 1px solid;border-radius: 5px;font-size: 15px;display: block;" placeholder="请输入验证码" name="code" id="verification" />-->
                    <!--<img src="${ctxPath}/userInfo/verification">-->
                    <!--</div>-->
                        <button class="layui-btn" style="width:180px;margin-top:20px" lay-submit="" id="btnLogin">立即登录</button>
                        <!--<div style="margin-top: 20px;">-->
                            <!--<a href="" id="forgetPassword" style="color: #8bc53f;">忘记密码</a>-->
                        <!--</div>-->
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        document.onkeydown = function(e){
            var ev = document.all ? window.event : e;
            if(ev.keyCode==13) {
                ajaxMain();
            }
        }
        $("#btnLogin").click(function(){
            ajaxMain();
        });
        function ajaxMain() {
            var loginName = $("#Login_operCd").val();
            if(loginName ==""){
                layer.msg('用户名不能为空！', {
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                });
                return;
            }
            var loginPwd = $("#Login_operPwd").val();
            if(loginPwd ==""){
                layer.msg('密码不能为空！', {
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                });
                return;
            }
            var param = {
                'code': loginName,
                'password': loginPwd
            }
            $.ajax({
                url:"${ctxPath}/login.do",
                type:"POST",
                data:param,
                dataType : 'json',
                success:function(rsp){
                    if(rsp.code ==400){
                        layer.msg(rsp.msg, {
                            time: 2000 //2秒关闭（如果不配置，默认是3秒）
                        });
                    }else{
                        window.location.href = "${ctxPath}/index.do";
                    }
                },
            })
        }
    });
    var height = $(window).height() > 445 ? $(window).height() : 445;
    $("#container").height(height);
    var bdheight = ($(window).height() - $('#bd').height()) / 2 - 20;
    $('#bd').css('padding-top', bdheight);
    $(window).resize(function(e) {
        var height = $(window).height() > 445 ? $(window).height() : 445;
        $("#container").height(height);
        var bdheight = ($(window).height() - $('#bd').height()) / 2 - 20;
        $('#bd').css('padding-top', bdheight);
    });
</script>
</html>